﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SWS.PIP.CMD
{
	public partial class InputForm : Form
	{
		public event EventHandler<EventArgs> OnConfirmClick;

		public InputForm()
		{
			InitializeComponent();
		}

		public void SetText(string sText)
		{
			textBox.Text = sText;
		}

		public string GetText()
		{
			return textBox.Text;
		}

		private void confirm_Click(object sender, EventArgs e)
		{
			this.Visible = false;
			OnConfirmClick(this, new EventArgs());
		}

		private void cancel_Click(object sender, EventArgs e)
		{
			Close();
		}

		private void textBox_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyValue == (int)Keys.Enter)
				confirm_Click(null, null);
			else if (e.KeyValue == (int)Keys.Escape)
				cancel_Click(null, null);
		}
	}
}
